<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>Document</title>
<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.color.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<link rel="stylesheet" href="../assets/app/css/app.css" />
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<style type="text/css">
li b span {
  padding-top: 10px;
}
li b span {
  width:25%;
  text-align:center;
  float: left;
}
.huouser{display:none;}
</style>
</head>
<body>
<!--通用顶部-->
<div id="ios-top-box">
	<div id="header" class="bar bar-nav">
	<div class="titlebar">
	<a href="javascript:appClose('userbuydetail',api);"><i class="iconfont iconline-arrow-left"></i></a>
	<h1 class="title">购买详情</h1>
	</div>
	</div>
</div>
<!--通用顶部结束-->
<input type="hidden" name="dataserver" value="0"/>
<input type="hidden" name="goods_id" value="0"/>
<input type="hidden" name="isfree" value="0"/>
<section class="notBottom">
	<div class="scroller create_goods" style="display:none;">
	    <ul class="listitem count_goods" style="background:#f5f5f5">
	        <li style="border-bottom:1px solid #ccc;">
	            <a href="javascript:;" class="dataserver"><img data-original="" width="25%" class="lazy img"/></a>
	        	<div class="text">
	                <p><a href="javascript:;" class="dataserver goodsname"></a></p>
					<p class="huouser">获得者：<em class="blue" style="font-style: normal;"></em></p>
					<p class="huouser">揭晓时间：<em class="gray6" style="font-style: normal;">00:00:00</em></p>
				</div>
	        </li>
	        <li class="box_shadow">
	        	<span>本期商品您总共拥有<em class="orange" style="font-style: normal;">0 </em>个<font class="webname">云购</font>码</span>
	        	<p class="gray9"><span class="gonumber">0人次</span></p>
	        </li>
	    </ul>
		    <ul>
			    <li><b class="yuncode"></b></li>
		    </ul>
		    <div class="clear"></div>
		    <div class="block20"></div>
	</div>
</section>

<script type="text/javascript" charset="utf-8">
apiready = function(){
  var userinfo;
  if(userinfo = getUserinfo()){
  	  var orderid = localData.get('orderid');
  	  if(orderid){
          api.showProgress({title : '加载中',text : ''});
  		  GetJPData(config.url+'/app.php?act=userbuydetail&uid='+userinfo['uid'],{orderid:orderid},function(data){
  			  api.hideProgress();
  			  if(data['status'] == 1){
  				  $('.create_goods').show();
  				  $('.goodsname').html(data['data']['shopname']);
  				  $('.img').attr('data-original',config.upload_url+'/'+data['data']['thumb']);
  	  			  $('.yuncode').html(data['data']['goucode']);
  	  			  $('.orange').text(data['data']['gonumber']);
  	  			  $('.webname').text(data['webname']);
  	  			  $('input[name=goods_id]').val(data['data']['shopid']);
  	  			  $('p.gray9').html(data['data']['time']+' <span class="gonumber">'+data['data']['gonumber']+'人次</span>');
  	  			  
				  if(data['diffTime'] <= 0){
  	  	  			  if(data['lottery']['q_uid']){
  	  	  				  $('input[name=dataserver]').val(1); //已经开奖
  	  	  				  $('.huouser em.blue').text(data['lottery']['q_user']);
  	  	  				  $('.huouser em.gray6').text(data['data']['q_end_time']);
  	  	  				  $('.huouser').show();
  	  	  			  } 
  	  			  }
				  
				  if (data['lottery']['isFree'] == 1) {
				  	  $('input[name=isfree]').val(1);
				  }
				  
  	  			  lyzimg();
  	  		  }else{
  	  			$.PageDialog.fail(data['msg']);
  	  		  }
  	  	  });
  		  
  		  $('.dataserver').click(function(){
  			  var goods_id = $('input[name=goods_id]').val();
  			  var dataserver = $('input[name=dataserver]').val();
  			  if(goods_id){
  				if(dataserver == 0){
					if($('input[name=isfree]').val() == '1'){
						openItem('f_item',goods_id,function(id){
  							localData.set('f_goods_id',id);
  						});
					}else{
						openItem('item',goods_id,function(id){
  							localData.set('goods_id',id);
  						});
					}
  				}else if (dataserver == 1){
  					openItem('dataserver',goods_id,function(id){
  						localData.set('dataserver_goods_id',id);
  					});
  				}
  			  }else{
  				$.PageDialog.fail('商品不存在'); 
  			  }
  		  });
  		  
  	  }else{
  		$.PageDialog.fail('订单id不存在');
  	  }
  }
};
</script>
</body>
</html>